package ASWebDavTest 
{
	import mx.collections.ArrayCollection;
	import mx.collections.ICollectionView;
	import mx.controls.treeClasses.ITreeDataDescriptor;
	import mx.controls.treeClasses.ITreeDataDescriptor2;

	public class FileDescriptor implements ITreeDataDescriptor
	{
		public function FileDescriptor()
		{
		}
		
		public function getChildren(node:Object, model:Object = null):ICollectionView
		{
			var tn:BaseFile = node as BaseFile;
			return tn.children;
		}
		
		public function hasChildren(node:Object, model:Object = null):Boolean
		{
			var tn:BaseFile = node as BaseFile;
			if (tn.IsFolder == false)
				return false;
			return tn.Files.length > 0;
		}
		
		public function isBranch(node:Object, model:Object = null):Boolean
		{
			var tn:BaseFile = node as BaseFile;
			return tn.IsFolder;
		}
		
		public function getData(node:Object, model:Object = null):Object
		{
			return node;
		}
		
		public function addChildAt(parent:Object, newChild:Object, index:int, model:Object = null):Boolean
		{
			return false;
		}
		
		public function removeChildAt(parent:Object, child:Object, index:int, model:Object = null):Boolean
		{
			return false;
		}
	}

}